(function(){
	pos = 0;
	ticking = false;
	var header = document.querySelector(".header1");
	window.addEventListener("scroll", function(e){
		pos = window.scrollY;
		if(pos > 5 && !ticking){
			header.classList.add("scroll");
			ticking = true;
		}
		if(pos < 5 && ticking){
			header.classList.remove("scroll");
			ticking = false;
		}
	});
})();

$.ajax({
	type:'get',
	url:'../json/xiangqing.json',
	success:function(res){
		var str = template('content',{data:res});
		$('.main').append(str);
	}
})

var mySwiper = new Swiper('.swiper-container', {
	pagination : '.swiper-pagination',
	autoplay: 3000,//可选选项，自动滑动
	loop: true,
})

$('.main').on('click','.p',function(){
	$('.active_p').removeClass('active_p');
	$(this).addClass('active_p');
	var index = $(this).index();
	console.log(index)
	$('.bottom').children().eq(index).show().siblings().hide();
})

